package com.framework.GameUI
{

	
	import com.framework.BasicButton;
	import com.framework.ButtonInfo;
	import com.framework.CustomEventButton;
	
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	public class StageButton extends BasicButton
	{
		public var stage_id:int;
		public var level_id:int;
		public var bg:MovieClip;
		
		public var txt:resBtnStageText;
		
//		public function StageButton()
//		{
//			super();

//		}
		
		public function StageButton(stage_id:int,level_id:int)
		{
			this.stage_id = stage_id;
			this.level_id = level_id;
		//	btnName = ButtonInfo.BUTTON_STAGE_SELECT;
			txt = new resBtnStageText;
			txt.ID.text = this.level_id.toString();
		//	super();
		}
		
		override public function buttonEventDispathcer(e:MouseEvent):void
		{
			var a : Boolean = dispatchEvent(new CustomEventButton(CustomEventButton.STAGE_ID,_btnName,_id,stage_id,level_id));
			trace("STAGE BUTTON CLICKED:", stage_id,level_id);
		}
		
		override public function init(e:Event=null):void
		{
			
		}
		
		public function setButton(val):MovieClip
		{
			switch(val)
			{
				case 1:
					bg = new resStageBtn1();
					break;
				case 2:
					bg = new resStageBtn2();
					break;
				case 3:
					bg = new resStageBtn3();
					break;
			}
			if(bg!=null)
			{
				addChild(bg);
				addChild(txt);
			}
			return bg;
		}
	}
}